#include <stdio.h>
#include <string.h>
#include <math.h>

int map[52][52];
int used[52];
int n;

char getone()
{
	char ch;
	scanf("%c", &ch);
	while (ch==' ' || ch=='\n') scanf("%c", &ch);
	return ch;
}

void read(int father)
{
	char ch;
	int a;
	ch=getone();
	a=ch-'0';
	ch=getone();
	if (ch>='0' && ch<='9') 
	{
		a=a*10+ch-'0';
		ch=getone();
	}
	n++;
	map[father][a]=map[a][father]=1;
	while (1)
	{
		
		if (ch==')') return;
		else if (ch=='(')
			read(a);
		ch=getone();
	}
	
}


void check()
{
	int i,j;
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=n;j++)
			printf("%d", map[i][j]);
		printf("\n");
	}
}
main()
{
	char ch;
	int i,j,tot,k;

	while (scanf("%c",&ch)!=EOF)
	{
		if (ch==' ' || ch=='\n') continue;
		memset(used,0,sizeof(used));
		memset(map,0,sizeof(map));
		n=0;
		read(0);
	//	check();
		if (n==1)
		{
			printf("\n");
			continue;
		}
		for (i=1;i<=n;i++)
		{
			tot=0;
			for (j=1;j<=n;j++)
				if (map[i][j]==1) tot++;
			map[i][0]=tot;			
		}
		for (k=1;k<n-1;k++)
		{
			for (i=1;i<=n;i++)
				if (map[i][0]==1)
					break;
			for (j=1;j<=n;j++)
				if (map[i][j]==1)
					break;
			map[i][j]=map[j][i]=0;
			map[i][0]--;
			map[j][0]--;
			printf("%d ",j);
		}
		for (i=1;i<=n;i++)
			if (map[i][0]==1)
				break;
		for (j=1;j<=n;j++)
			if (map[i][j]==1)
				break;
		printf("%d\n", j);
		
	}

	return 0;
}
